package com.jd.platform.gobrs.sample.hcache;

import com.jd.platform.gobrs.client.hcache.HCacheWrapper;
import org.springframework.stereotype.Component;

/**
 * @program: gobrs
 * @ClassName RedisCacheService
 * @description: 自定义二级缓存实现类
 * @author: sizegang
 * @create: 2022-01-09 00:46
 * @Version 1.0
 **/
@Component
public class RedisCacheService extends HCacheWrapper {

//    @Autowired
//    private RedisTemplate redisTemplate;

    @Override
    public Object doGetValue(String key) {
        if (true) {
            return "这是从二级缓存中取的值";
        } else {
            Object result = null;
            if (result != null) {
                System.out.println("从上游RPC 或者从数据库取到");
                // 设置二级缓存
                return result;
            }
            return null;
        }
    }

}
